package com.xucy.springboot.designmodel.behavioral.observer;

import lombok.Getter;
import lombok.Setter;

import java.util.Observable;
import java.util.Observer;

/**
 * @Author xucy
 * @Date 2019-07-28 11:29
 * @Description
 **/

@Setter
@Getter
public class Teacher implements Observer {

    private String teacherName;

    public Teacher(String teacherName) {
        this.teacherName = teacherName;
    }

    @Override
    public void update(Observable o, Object arg) {
        Course course=(Course)o;

        Question question=(Question) arg;

        System.out.println(teacherName+"收到了"+question.getQuestionName()+"提交的关于"+course.getCourseName()+"问题，问题内容是"+question.getQuestionContext());
    }
}
